package com.copro.chemdb.subject;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import com.copro.simple.Application;
import com.copro.simple.SimpleException;

public class DeleteSubjectAction extends Action {

	@Override
	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		try {
			Application app = Application.me(request);
			app.execBatchByKey(form, "delOptions", "delSubject");
		} catch (SimpleException e) {
			request.setAttribute("error", e.getMessage());
			return mapping.findForward("del-failed");
		}
		return mapping.findForward("del-ok");
	}

}
